<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
      .hide {
          display: none;
      }
  </style>
</head>
<body>
<div>houdunren</div>
<div>hdcms.com</div>
</body>
<script>
  /*...可以把一些元素转为数组使用*/
  let divs = document.querySelectorAll('div');
  //还可以使用 Array.from(divs)
  console.log([...divs]);
  [...divs].map(i => i.addEventListener('click', function () {
    this.classList.toggle('hide');
  }))

</script>
</html>